<?php
function curl_get_contents($url,$postData=null){
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_TIMEOUT, 5);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    if ($postData) {
    　　curl_setopt($ch, CURLOPT_POST, 1);
    　　curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
    }
    $r = curl_exec($ch);
    curl_close($ch);
    return $r;
}

$url= 'http://localhost/test/ip.php';
$ip = '255.20.13.145';
$url = $url.'?ip='.$ip;
$result = curl_get_contents($url);//接收数据
echo $result;